using System;
using System.ComponentModel;
using System.Windows.Forms;
using App.Modelo.Interfaces;

namespace App.Git.Vista.Widget
{
    public partial class DomicilioControl : UserControl
    {
        public event PropertyChangedEventHandler DomicilioChanged;
        
        public DomicilioControl()
        {
            InitializeComponent();
            domicilioBindingSource.DataSource = new Domicilio();
        }

        [Bindable(true)]
        public virtual IDomicilio Domicilio
        {
            get
            {
                return domicilioBindingSource.DataSource is IDomicilio
                    ? (IDomicilio)domicilioBindingSource.DataSource
                    : null;
            }
            set
            {
                domicilioBindingSource.DataSource  = value;
            }
        }

        private void domicilioBindingSource_CurrentItemChanged(object sender, EventArgs e)
        {
            if (DomicilioChanged != null)
                DomicilioChanged(this, new PropertyChangedEventArgs("Domicilio"));
        }

        private void tableLayoutPanel1_Paint(object sender, PaintEventArgs e)
        {

        }


    }
}
